package cn.onein.edu.biz.bean;

import cn.onein.edu.common.ProductPeriodType;
import cn.onein.edu.common.ProductType;

public class Product {

	private Long id;
	
	private String name;
	
	private Integer price;
	
	private ProductType type;
	
	private String description;
	
	private ProductPeriodType productPeriodType;

	public ProductPeriodType getProductPeriodType() {
		return productPeriodType;
	}

	public void setProductPeriodType(ProductPeriodType productPeriodType) {
		this.productPeriodType = productPeriodType;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public ProductType getType() {
		return type;
	}

	public void setType(ProductType type) {
		this.type = type;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getPrice() {
		return price;
	}

	public void setPrice(Integer price) {
		this.price = price;
	}

	public void setTypeValue(Integer typeValue) {
		ProductType[] types = ProductType.values();
		this.type = types[typeValue];
	}
	
	public void setProductPeriodTypeValue(Integer productPeriodTypeValue){
		if(productPeriodTypeValue == null){
			this.productPeriodType = null;
			return;
		}
		ProductPeriodType[] type = ProductPeriodType.values();
		this.productPeriodType = type[productPeriodTypeValue];
	}
	
	public Integer getProductPeriodTypeValue(){
		return this.productPeriodType.ordinal();
	}
	
}
